<template>
  <view class="c-list-loading" :class="{ 'c-list-loading-show': !loading, 'c-list-loading-fiexd-top': fiexdTop }">
    <view class="loading-view"></view>
    <view class="loading-view"></view>
    <view class="loading-view"></view>
    <view class="loading-view"></view>
    <view class="loading-view"></view>
  </view>
</template>
<script setup>
import { defineProps } from 'vue'

const props = defineProps({
  loading: {
    type: Boolean,
    default: true
  },
  fiexdTop: {
    type: Boolean,
    default: false
  }
})
</script>
<style lang="scss">
.c-list-loading-fiexd-top {
  position: absolute;
  top: -50px;
  left: 0;
}
.c-list-loading {
  display: inline-block;
  font-size: 0px;
  padding: 0px;
  width: 100%;
  text-align: center;
}
.c-list-loading-show {
  // display: none !important;
  opacity: 0;
}
.loading-view {
  vertical-align: middle;
  border-radius: 100%;

  display: inline-block;
  width: 7px;
  height: 7px;
  margin: 24px 2px;
  animation: loading-animation 0.8s linear infinite alternate;
}

.c-list-loading view:nth-child(1) {
  animation-delay: -1s;
  background: #ff517797;
  // background: rgba(0, 0, 0, 0.6);
}

.c-list-loading view:nth-child(2) {
  animation-delay: -0.8s;
  background: #ff5177cc;
  // background: rgba(0, 0, 0, 0.8);
}

.c-list-loading view:nth-child(3) {
  animation-delay: -0.25s;
  background: #ff5177;
  // background: rgba(0, 0, 0, 1);
}

.c-list-loading view:nth-child(4) {
  animation-delay: -0.8s;
  background: #ff5177cc;
  // background: rgba(0, 0, 0, 0.8);
}

.c-list-loading view:nth-child(5) {
  animation-delay: -1s;
  background: #ff517766;
  // background: rgba(0, 0, 0, 0.4);
}

@keyframes loading-animation {
  from {
    transform: scale(0, 0);
  }

  to {
    transform: scale(1, 1);
  }
}
</style>
